package com.party.admin.web.controller.crowdfundMultiple;


import com.party.admin.biz.crowdfund.SupportBizService;
import com.party.common.paging.Page;
import com.party.core.model.crowdfund.SupportWithMember;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * @ClassName SupportMultipleController
 * @Description 支持者控制器
 * @Author yifeng
 * @Date 2019/3/25 10:52
 **/
@Controller
@RequestMapping("activityMultiple/support")
public class SupportMultipleController {
    @Autowired
    private SupportBizService supportBizService;

    /**
     * @param id                活动id
     * @param supportWithMember
     * @param page
     * @param source
     * @return
     * @Author yifeng
     * @Description 众筹项目查询支持
     * @Date 9:18 2019/3/27
     **/
    @RequestMapping(value = "activity/listForProject")
    public ModelAndView listForProjectActivity(String id, SupportWithMember supportWithMember, Page page, Integer source) {
        ModelAndView modelAndView = new ModelAndView("activity/supportForProjectList");
        modelAndView.addObject("isMultiple", true);
        modelAndView.addAllObjects(supportBizService.listForProjectCommonActivity(id, supportWithMember, page, source));
        return modelAndView;
    }

    /**
     * @param id         活动id
     * @param relationId 分销关系id
     * @param merchantId 商户id
     * @param page       分页参数
     * @return
     * @Author yifeng
     * @Description 根据分销关系编号查询支持列表
     * @Date 9:20 2019/3/27
     **/
    @RequestMapping(value = "activity/listForDistributor")
    public ModelAndView listForDistributorActivity(String id, String relationId, String merchantId, Page page) {
        ModelAndView modelAndView = new ModelAndView("activity/supportList");
        modelAndView.addObject("isMultiple", true);
        modelAndView.addAllObjects(supportBizService.listForDistributorCommonActivity(id, relationId, merchantId, page));
        return modelAndView;
    }

    /**
     * @param eventId    主题id
     * @param relationId 分销关系id
     * @param merchantId 商户id
     * @param page       分页参数
     * @return
     * @Author yifeng
     * @Description 根据分销关系编号查询支持列表
     * @Date 9:22 2019/3/27
     **/
    @RequestMapping(value = "event/listForDistributor")
    public ModelAndView listForDistributorEvent(String eventId, String relationId, String merchantId, Page page) {
        ModelAndView modelAndView = new ModelAndView("crowdfund/supportList");
        modelAndView.addObject("isMultiple", true);
        modelAndView.addAllObjects(supportBizService.listForDistributorCommonEvent(eventId, relationId, merchantId, page));
        return modelAndView;
    }


    /**
     * @param eventId    主题id
     * @param projectId  众筹id
     * @param merchantId 商户id
     * @param page       分页
     * @return
     * @Author yifeng
     * @Description 主题的众筹的支持者列表
     * @Date 17:22 2019/3/25
     **/
    @RequestMapping(value = "event/listForProject")
    public ModelAndView listForProjectEvent(String eventId, String projectId, String merchantId, Page page, String startTime) {
        ModelAndView modelAndView = new ModelAndView("crowdfund/supportForProjectList");
        SupportWithMember supportWithMember = new SupportWithMember();
        supportWithMember.setMerchantId(merchantId);
        supportWithMember.setProjectId(projectId);
        modelAndView.addObject("isMultiple", true);
        modelAndView.addAllObjects(supportBizService.listForProjectCommonEvent(page, eventId, supportWithMember, startTime));
        return modelAndView;
    }

    /**
     * @param eventId    主题id
     * @param projectId  众筹id
     * @param merchantId 商户id
     * @param page       分页参数
     * @return
     * @Author yifeng
     * @Description 众筹项目查询支持
     * @Date 9:25 2019/3/27
     **/
    @RequestMapping(value = "event/listForRepresent")
    public ModelAndView listForRepresentEvent(String eventId, String projectId, String merchantId, Page page) {

        ModelAndView modelAndView = new ModelAndView("crowdfund/supportForRepresentList");
        SupportWithMember supportWithMember = new SupportWithMember();
        supportWithMember.setProjectId(projectId);
        supportWithMember.setMerchantId(merchantId);
        modelAndView.addAllObjects(supportBizService.listForRepresentCommonEvent(eventId, page, supportWithMember));
        modelAndView.addObject("isMultiple", true);
        return modelAndView;
    }

    /**
     * @param id                活动id
     * @param supportWithMember 查询参数
     * @param page              分页参数
     * @return
     * @Author yifeng
     * @Description 众筹项目查询支持
     * @Date 9:26 2019/3/27
     **/
    @RequestMapping(value = "activity/listForRepresent")
    public ModelAndView listForRepresentActivity(String id, SupportWithMember supportWithMember, Page page) {
        ModelAndView modelAndView = new ModelAndView("activity/supportForRepresentList");
        modelAndView.addObject("isMultiple", true);
        modelAndView.addAllObjects(supportBizService.listForRepresentCommonActivity(id, page, supportWithMember));
        return modelAndView;
    }
}